package main
import "fmt"
/* func main(){
	//定义二维数组
	var arr [2][3]int16
	fmt.Println(arr)
    //内存
	fmt.Printf("arr的地址是：%p\n",&arr)
	fmt.Printf("arr[0]的地址是：%p\n",&arr[0])
	fmt.Printf("arr[0][0]的地址是：%p\n",&arr[0][0])
	fmt.Printf("arr[1]的地址是：%p\n",&arr[1])
	fmt.Printf("arr[1][0]的地址是：%p\n",&arr[1][0])
	//赋值
	arr[0][1] = 11
	arr[0][0] = 62
	arr[1][2] = 78
	fmt.Println(arr)
	//初始化操作
	var arr1 = [2][3]int{{1,2,3},{4,5,6}}
	fmt.Println(arr1)

} */

//二维数组的遍历
func main(){
	//定义二维数组
	var arr = [3][3]int{{1,2,3},{4,5,6,},{7,8,9}}
	fmt.Println(arr)
	fmt.Println("------------------------")
	//for循环
	for i := 0;i<len(arr);i++{
		for j := 0;j<len(arr[i]);j++{
			fmt.Print(arr[i][j],"\t")
		}
		fmt.Println()
	}
	//for range循环
	for key,value := range arr{
		for k,v := range value {
			fmt.Printf("arr[%v][%v]=%v\t",key,k,v)
		}
		fmt.Println()
	}
}